<script setup>
  import { onMounted, ref } from 'vue'
  const prors = defineProps({
    second: {
      type: Number,
      default: 60
    }
  })
  const emit = defineEmits(['timeup'])
  const remaining = ref(prors.second)
  onMounted(() => {
    const clock = setInterval(() => {
      remaining.value--
      if (!remaining.value) {
        clearInterval(clock)
        emit('timeup')
      }
    }, 1000)
  })
</script>
<template>
  {{ remaining < 10 ? '0' + remaining : remaining }}
</template>

<style></style>
